package com.qk.management.mapper;

import com.qk.entity.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {

    @Insert("INSERT INTO dept(name, status, create_time, update_time) VALUES(#{name}, #{status}, #{createTime}, #{updateTime})")
    void insertDept(Dept dept);

    Integer count(String name, Integer status);

    List<Dept> page(String name, Integer status, Integer offset, Integer pageSize);

    @Delete("DELETE FROM dept WHERE id = #{id}")
    void deleteDept(Integer id);

    @Select("SELECT * FROM dept WHERE id = #{id}")
    Dept selectById(Integer id);

//    @Update("update dept set name = #{name}, status = #{status}, update_time = #{updateTime} where id = #{id}")
    void updateDept(Dept dept);

    @Select("SELECT * FROM dept WHERE status = 1")
    List<Dept> listDept();
}